-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(contentful-apps): Handle org subpage and parent subpage preview link routing #17369
fix(contentful-apps): Handle org subpage and parent subpage preview link routing #17369
Conversation
WalkthroughThe pull request modifies the Changes
Sequence DiagramsequenceDiagram
participant Component as PreviewLinkSidebar
participant Handler as previewLinkHandler
participant CMA as Contentful Management API
Component->>Handler: organizationSubpage(entry, cma)
Handler->>CMA: Fetch organization page
Handler->>CMA: Fetch parent subpages
CMA-->>Handler: Return page and subpage data
Handler->>Handler: Construct URL based on retrieved data
Handler-->>Component: Return preview link
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17369 +/- ##
==========================================
- Coverage 35.68% 35.67% -0.01%
==========================================
Files 6932 6931 -1
Lines 148815 148788 -27
Branches 42519 42506 -13
==========================================
- Hits 53098 53075 -23
+ Misses 95717 95713 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 14 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/contentful-apps/pages/sidebars/preview-link.tsx (1)
86-100
: Refactor to reduce duplicated fetch logic
BothorganizationSubpage
andorganizationParentSubpage
share similar steps for retrieving the organization page and building a URL. Consider extracting this logic into a shared helper function to improve maintainability and consistency.+ // Example shared helper + async function fetchOrganizationPage(cma: CMAClient, id: string) { + return cma.entry.get({ + entryId: id, + environmentId: CONTENTFUL_ENVIRONMENT, + spaceId: CONTENTFUL_SPACE, + }) + } organizationParentSubpage: async (entry, cma) => { const organizationPageId = entry.fields.organizationPage?.[DEFAULT_LOCALE]?.sys?.id - const organizationPage = await cma.entry.get({ ... }) + const organizationPage = await fetchOrganizationPage(cma, organizationPageId) ... },
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/contentful-apps/pages/sidebars/preview-link.tsx
(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/contentful-apps/pages/sidebars/preview-link.tsx (1)
Pattern apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (1)
apps/contentful-apps/pages/sidebars/preview-link.tsx (1)
6-6
: No significant changes introduced at this line.
Datadog ReportBranch report: ✅ 0 Failed, 84 Passed, 0 Skipped, 24.68s Total Time |
Handle org subpage and parent subpage preview link routing
What
Now org subpages can belong to a so called "parent subpage", so their preview links depend on that
Checklist:
Summary by CodeRabbit
New Features
Performance